//
//  ShareCell.m
//  ShareYOU
//
//  Created by 杨亭 on 14-12-17.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ShareCell.h"

@implementation ShareCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //如果使用代码创建视图, 需要在这个初始化方法中给视图属性赋值.
        self.shareLabel = [[UILabel alloc] init];
        self.shareLabel.backgroundColor = [UIColor redColor];
        //系统为了方便自定义视图的管理, 有一个专为自定义视图设置的contentView.
        [self.contentView addSubview:self.shareLabel];
        [_shareLabel release];
        
        self.shareImageView = [[UIImageView alloc] init];
        self.shareImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.shareImageView];
        [_shareImageView release];
        
        self.shareTimeLabel = [[UILabel alloc] init];
        self.shareTimeLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.shareTimeLabel];
        [_shareTimeLabel release];
        
        self.shareButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.shareButton.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.shareButton];
        
        
        
    }
    return self;
}

//系统的方法, 在cell显示到屏幕之前, 最后调用的一个方法.
//在这个方法中, cell自己的高度和属性都是有值的, 而且是最新的值
-(void)layoutSubviews
{
    [super layoutSubviews];
    _shareLabel.frame = CGRectMake(20, 10, 330, 70);
    _shareImageView.frame = CGRectMake(60, 90, 220, 130);
    _shareTimeLabel.frame = CGRectMake(20, 230, 100, 20);
    _shareButton.frame = CGRectMake(300, 230, 40, 20);
    [_shareButton setTitle:@"点击" forState:UIControlStateNormal];
    [_shareButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    
}

//按钮方法
- (void)buttonClicked:(UIButton *)shareButton
{
    //显示两个按钮
    
    
}





- (void)dealloc
{
    [_shareButton release];
    [_shareImageView release];
    [_shareLabel release];
    [_shareTimeLabel release];
    [super dealloc];
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
